﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Text;
using MedReg.Utils;

namespace MedReg
{
    public partial class MedregDBDataContext
    {
        public override void SubmitChanges(ConflictMode failureMode)
        {
            ChangeSet changes = GetChangeSet();
            failureMode = ConflictMode.ContinueOnConflict;
            try
            {

                base.SubmitChanges(failureMode);
            }
            catch(System.Data.SqlClient.SqlException ex)
            {
                Logger.WriteLine(ex.Message);
            }
            Logger.WriteLine("Обновлено " + changes.Updates.Count());
            Logger.WriteLine("Вставлено " + changes.Inserts.Count());
            Logger.WriteLine("Удалено " + changes.Deletes.Count());
        }
    }
}
